const isMobileDevice = () => {
    // 判断用户代理
    const userAgent = navigator.userAgent.toLowerCase();
    const isMobileUA =
        /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/.test(
            userAgent
        );

    // 判断屏幕比例
    const screenRatio = window.innerWidth / window.innerHeight;
    const isPortraitMode = screenRatio <= 1;

    // 综合判断
    return isMobileUA || isPortraitMode;
};